"""
---------------------------------------------------------------------
- File: base_models.py
- Date: 2025/7/28
- Author: yangzhide
- Email: xxzjyzd@126.com
- Description: 基础数据库模型
---------------------------------------------------------------------
"""

from tortoise import models, fields


class IdTimestampMixin(models.Model):
    """基础数据库模型--创建/更新时间"""

    id = fields.IntField(pk=True)
    create_time = fields.DatetimeField(
        null=True, auto_now_add=True, description="创建时间"
    )
    create_by = fields.CharField(max_length=32, default="", description="创建人")
    update_time = fields.DatetimeField(null=True, auto_now=True, description="更新时间")
    update_by = fields.CharField(max_length=32, default="", description="更新人")

    class Meta:
        abstract = True  # 抽象类
